// 首页头部效果js
var divs = document.querySelectorAll(".header>div");

divs.forEach(function(e, i) {
    e.onmouseenter = function () {
        divs.forEach(function (e){
           e.style.backgroundColor = '#ffffff';
           e.style.color = '#000000';
        });
        e.style.backgroundColor = '#38ABFF';
        e.style.color = '#ffffff';
        // console.log(e.style.color);
    };
});

divs.forEach(function(e, i) {
    e.onmouseleave = function () {
        divs.forEach(function (e){
            e.style.backgroundColor = '#ffffff';
            e.style.color = '#000000';
        });
        // e.style.backgroundColor = '#38ABFF';
        // e.style.color = '#ffffff';
        // console.log(e.style.color);
    };
});

// 登录弹窗
var loginBtn = document.getElementById('login');
var loginDiv = document.getElementById('login_div');
// var count = 0;
loginBtn.onclick = function (evt) {
    // count++;
    loginDiv.style.display = 'inline-block';
    // console.log(count);
    // console.log(loginDiv.style.display);
    evt.stopPropagation();
};

loginDiv.addEventListener('click',function (evt) {
    console.log("222222");

    evt.stopPropagation();
});

document.addEventListener("click", function (evt) {
    console.log("1111");
    loginDiv.style.display = "none";

});

// 轮播图效果js
var mySwiper = new Swiper('.swiper-container', {
    loop:"true",
    autoplay: 5000,//可选选项，自动滑动
    direction: "horizontal",
    // effect: "cube",

    // 如果需要分页器
    pagination: '.swiper-pagination',

});

// 科目效果js
var courseDivs = document.querySelectorAll('.course_name');

courseDivs.forEach(function (e,i) {
    e.onmouseenter = function () {
        courseDivs.forEach(function (e) {
            e.style.backgroundColor = '#38ABFF';
            e.style.color = '#ffffff';
        });
        e.style.backgroundColor = '#ffffff';
        e.style.color = '#38ABFF';
    };
});